//
//  HomeSegmentCollectionCell.swift
//  ManBetX
//
//  Created by Cocoa on 2020/4/20.
//  Copyright © 2020 Fullen. All rights reserved.
//

import UIKit

/**
 * 首页HomeSegmentCollectionCell
 */


// 点击回调
typealias SegmentViewCellInfoBlock = () -> Void

class HomeSegmentCollectionCell: BaseCollectionViewCell {
    
    @IBOutlet weak var bgImageView: UIImageView!// 背景图片
    @IBOutlet weak var underMaintenanceImageView: UIImageView!// 维护中图片
    @IBOutlet weak var chineseTitle: UILabel!// 中文标题
    @IBOutlet weak var englishTitle: UILabel!// 英文标题
    @IBOutlet weak var infoNumberLabel: UILabel!// 人数信息
    @IBOutlet weak var praiseButton: UIButton!// 点赞数
    
    var praiseButtonClickBlock:SegmentViewCellInfoBlock?
    var dataDic: [String: Any] = NSDictionary.init() as! [String : Any]
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.selectedBackgroundView = UIView()
        self.selectedBackgroundView?.backgroundColor = UIColor.white
    }
    
    override func configure(_ entity: Any) {
        if entity is HomeSegmentViewModel {
            let viewModel = entity as! HomeSegmentViewModel
            
            self.bgImageView.sd_setImage(with: URL(string: viewModel.imgNameIOS), placeholderImage: imageNamed("icon_newhome_game_zwt_bg_max"), options: .refreshCached, completed: nil)
            
            self.underMaintenanceImageView.isHidden =  !viewModel.isUnderMaintenance
        }
    }
    
    // 点赞
    @IBAction func praiseButtonClick(_ sender: UIButton) {
        if self.praiseButtonClickBlock != nil {
            self.praiseButtonClickBlock!()
        }
        
    }
    
    

}
